#ifndef _STD_TCPSERVICE_H_
#define _STD_TCPSERVICE_H_

#include<stdio.h>
#include<iostream>
#include<string>
//通信类
class StdTcpSocket
{
public:
    StdTcpSocket()
    {

    }
    ~StdTcpSocket()
    {

    }
public:
    //连接服务器
    bool connectToServer(const char *ip,int port);
    //发送数据
    int sendMessage(const void *sendMsg,size_t size);
    //发送数据
    int sendMessage(const std::string &sendMsg);
    //接收数据
    int recvMessage(void *buf,size_t size);
    //接收数据
    int recvMessage(std::string &recvMessage);

    //设置通信句柄
    void setAttrConnfd(int connfd);

private:
    int m_connfd;
};


//服务器类
class StdTcpServer
{
private:
    
public:
    //设置监听
    void setListen(int port);
    //得到与客户端的通信句柄(类)
    StdTcpSocket * getClientSocket();
private:
    int m_port;
    //sockfd句柄
    int m_sockfd;
};

#endif